#include "AudioLivePage.h"
#include "ui_AudioLivePage.h"
#include <QResizeEvent>
AudioLivePage::AudioLivePage(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::AudioLivePage)
{
    ui->setupUi(this);
    InitBGI();
    UpdateBGI(this->geometry().width(),this->geometry().height());
}

void AudioLivePage::InitBGI()
{
    unliveBGI_ = new QFrame(this);
    unliveBGI_->setObjectName("audioliveBG");
    unliveBGI_->setGeometry(this->geometry());
    unliveBGI_->lower();
}

AudioLivePage::~AudioLivePage()
{
    delete ui;
}

void AudioLivePage::resizeEvent(QResizeEvent *event)
{
    unliveBGI_->setGeometry(0,0,event->size().width(),event->size().height());
    UpdateBGI(event->size().width(),event->size().height());
}

void AudioLivePage::UpdateBGI(int width,int height)
{
    //ps:
    //standard width-122;standard height-216
    const float standardWidth = 122;
    const float standardHeight = 216;
    int targetWidth = width;
    int targetHeight = height;

    targetWidth = targetHeight/standardHeight*standardWidth;
    ui->frame_bgi->setFixedSize(targetWidth,targetHeight);
}
